package com.h3c.nem.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.h3c.nem.entity.SdAllWorker;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * Copyright (C), 2020-2020, h3c
 * FileName: SdAllWorkerMapper
 *
 * @Author: l22886
 * @Date: 2022-01-19
 * Description: sd_all_worker mapper
 * Version: 1.0
 */
public interface SdAllWorkerMapper extends BaseMapper<SdAllWorker> {

    /**
     * @title: queryListByFuzzy
     * @description: 模糊列表查询
     * @params: [ SdAllWorker ]
     * @return: java.util.List
     * @createTime: 2022-01-19
     * @version: 1.0
     * @author: l22886
     */
    public List<SdAllWorker> queryListByFuzzy(SdAllWorker SdAllWorker);

    /**
     * @title: queryListByFuzzy
     * @description: 精确列表查询
     * @params: [ SdAllWorker ]
     * @return: java.util.List
     * @createTime: 2022-01-19
     * @version: 1.0
     * @author: l22886
     */
    public List<SdAllWorker> queryList(SdAllWorker SdAllWorker);

    /**
     * @title: updateSdAllWorker
     * @description: 更新
     * @params: [ SdAllWorker ]
     * @return: java.lang.Integer
     * @createTime: 2022-01-19
     * @version: 1.0
     * @author: l22886
     */
    public Integer updateSdAllWorker(SdAllWorker SdAllWorker);

    /**
     * @title: insertSdAllWorker
     * @description: 插入
     * @params: [ SdAllWorker ]
     * @return: java.lang.Integer
     * @createTime: 2022-01-19
     * @version: 1.0
     * @author: l22886
     */
    public Integer insertSdAllWorker(SdAllWorker SdAllWorker);

    /**
     * @title: deleteSdAllWorker
     * @description: 删除
     * @params: [ SdAllWorker ]
     * @return: java.lang.Integer
     * @createTime: 2022-01-19
     * @version: 1.0
     * @author: l22886
     */
    public Integer deleteSdAllWorker(SdAllWorker SdAllWorker);

    @Select("select saw.*,tw.create_time as origin_create_time from tb_worker tw left join sd_all_worker saw on tw.worker_id = saw.worker_id " +
            "${ew.customSqlSegment}")
    List<Map<String, Object>> getNewWorker(@Param(Constants.WRAPPER) QueryWrapper<SdAllWorker> queryWrapper);

    @Select("select worker_id from sd_all_worker where domain_account = #{domain}")
    String selectWorkerIdByDomain(@Param("domain") String domain);
}
